home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / private / _gotoxy.c < prev    next >
C/C++ Source or Header  |  1993-06-18  |  2KB  |  80 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3. #ifdef UNIX
  4. #include <defs.h>
  5. #include <term.h>
  6. #endif
  7.  
  8. #ifdef PDCDEBUG
  9. char *rcsid__gotoxy = "$Header: C:\CURSES\private\RCS\_gotoxy.c 2.1 1993/06/18 20:23:26 MH Rel MH $";
  10. #endif
  11.  
  12.  
  13.  
  14.  
  15. /*man-start*********************************************************************
  16.  
  17.   PDC_gotoxy()    - position hardware cursor at (x, y)
  18.  
  19.   PDCurses Description:
  20.      This is a private PDCurses routine.
  21.  
  22.      Moves the physical cursor to the desired address on the
  23.      screen. We don't optimize here -- on a PC, it takes more time
  24.      to optimize than to do things directly.
  25.  
  26.   PDCurses Return Value:
  27.      This function returns OK on success and ERR on error.
  28.  
  29.   PDCurses Errors:
  30.      No errors are defined for this function.
  31.  
  32.   Portability:
  33.      PDCurses    int PDC_gotoxy( int row, int col );
  34.  
  35. **man-end**********************************************************************/
  36.  
  37. int    PDC_gotoxy(int row, int col)
  38. {
  39. #ifdef PDCDEBUG
  40.     if (trace_on) PDC_debug("PDC_gotoxy() - called: row %d col %d\n",row,col);
  41. #endif
  42.  
  43. #ifndef UNIX
  44.     if ((_cursvar.cursrow == row) && (_cursvar.curscol == col))
  45.         return( OK );
  46. #endif
  47.  
  48. #ifdef    FLEXOS
  49.     retcode = s_get(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  50.     if (retcode < 0L)
  51.         return( ERR );
  52.     vir.vc_cursor.pos_row = row;
  53.     vir.vc_cursor.pos_col = col;
  54.     retcode = s_set(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  55.     return( (retcode < 0L) ? ERR : OK );
  56. #endif
  57.  
  58. #ifdef    DOS
  59.     regs.h.ah = 0x02;
  60.     regs.h.bh = _cursvar.video_page;
  61.     regs.h.dh = (unsigned char) row;
  62.     regs.h.dl = (unsigned char) col;
  63.     int86(0x10, ®s, ®s);
  64.     return( OK );
  65. #endif
  66.  
  67. #ifdef    OS2
  68.     VioSetCurPos (row, col, 0);
  69.     return(OK);
  70. #endif
  71.  
  72. #ifdef UNIX
  73.     if (cursor_address != NULL)
  74.         {
  75.         putp(tparm(cursor_address,row,col));
  76.         }
  77.     return(OK);
  78. #endif
  79. }
  80.